<template>
  <el-dialog v-model="dialogVisible" class="!border-rd-10px" title="" width="500">
    <template #header="{ titleId }">
      <div class="dialog-title">
        <h3 :id="titleId">批量设置支付方式</h3>
        <h4 :id="titleId" class="mt-15px mb-20px">若无支付账户请联系客服开通</h4>
      </div>
    </template>
    <el-form
      ref="ruleFormRef"
      style="max-width: 600px"
      :model="ruleForm"
      label-width="auto"
      class="demo-ruleForm"
      :size="formSize"
      status-icon
    >
      <el-form-item label="征订公告">
        <el-select
          v-model="ruleForm.name"
          filterable
          multiple
          collapse-tags
          collapse-tags-tooltip
          placeholder="请选择征订公告"
        >
          <el-option label="222" value="1" />
          <el-option label="444" value="2" />
          <el-option label="2212" value="3" />
          <el-option label="113" value="4" />
        </el-select>
      </el-form-item>
    </el-form>
    <el-card shadow="hover" class="mt-40px">
      <template #header>
        <div class="card-header">
          <span>请选择支付方式</span>
        </div>
      </template>
      <el-checkbox v-model="checked1" label="先发衣服后收费" size="large" border />
      <el-checkbox v-model="checked1" label="先发衣服后收费" size="large" border />
    </el-card>
    <template #footer>
      <div class="text-center">
        <el-button type="primary" plain @click="handleClose">取消</el-button>
        <el-button type="primary" @click="submitForm(ruleFormRef)">确定</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue'
import type { ComponentSize, FormInstance, FormRules } from 'element-plus'

interface RuleForm {
  name: number[]
  type: string
}

const formSize = ref<ComponentSize>('default')
const ruleFormRef = ref<FormInstance>()
const ruleForm = reactive<RuleForm>({
  name: [],
  type: ''
})

const submitForm = async (formEl: FormInstance | undefined) => {
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      // console.log('submit!')
    } else {
      // console.log('error submit!', fields)
    }
  })
}

const dialogVisible = ref(false)
function show(val) {
  dialogVisible.value = val
}
const handleClose = () => {
  dialogVisible.value = false
}
defineExpose({ show, dialogVisible })
</script>
<style scoped lang="scss">
.dialog-title {
  h3 {
    line-height: var(--el-dialog-font-line-height);
    font-size: var(--el-dialog-title-font-size);
    color: var(--el-text-color-primary);
  }
  h4 {
    color: #a6a6a6;
    font-size: 11px;
  }
}
</style>
